package com.xuecheng.manage_cms;

import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableSwaggerBootstrapUI
@EntityScan("com.xuecheng.framework.domain.cms")    // 扫描实体类
@ComponentScan("com.xuecheng.api")  //扫描接口
@ComponentScan("com.xuecheng.manage_cms") //扫描本项目下的所有类
@ComponentScan("com.xuecheng.framework") // 扫描common项目下的framework
@EnableDiscoveryClient
public class ManageCmsApplication1 {
    public static void main(String[] args) {
        SpringApplication.run(ManageCmsApplication1.class);
    }

    /**
     *  使用OkHttp做RestTemplate
     * @return RestTemplate
     */
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate(new OkHttp3ClientHttpRequestFactory());
    }
}

